package com.loong.data.controller.backend;

import com.loong.common.mvc.BaseBackendController;
import com.loong.common.param.BaseIdParam;
import com.loong.common.rest.Result;
import com.loong.data.handler.GoodsCategoryHandler;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * @Description:
 * @Author: hzp
 * @Date: 2020-12-3 17:36
 */
@RestController
@RequestMapping("manage/data/goodsCategory")
public class GoodsCategoryController extends BaseBackendController {
    @Resource
    private GoodsCategoryHandler goodsCategoryHandler;

    /**
     * 根据店铺id查询商品类型
     * @param shopId 店铺id
     * @return 响应的结果
     */
    @PostMapping("findListByShopId")
    public Result findGoodsById(@RequestParam("shopId") Long shopId){
        BaseIdParam param = BaseIdParam.builder().id(shopId).build();
        return handlerExecutor.execute(() -> goodsCategoryHandler.findGoodsCategoryModelByShopIdBackend(param));
    }
}
